<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>部门管理</title>
	<link rel="stylesheet" href="../static/easyui/themes/bootstrap/easyui.css">
	<link rel="stylesheet" href="../static/easyui/themes/icon.css">
	<link rel="stylesheet" href="../static/custom.css">
	<script type="text/javascript" src="../static/easyui/jquery.min.js"></script>
	<script type="text/javascript" src="../static/easyui/jquery.easyui.min.js"></script>
	<script type="text/javascript" src="../static/easyui/locale/easyui-lang-zh_CN.js"></script>
	<script type="text/javascript" src="../static/custom.js"></script>
</head>
<body>
<table id="dept_manage"></table>
<script type="text/javascript">
	$(function(){
		$('#dept_manage').treegrid({
			idField: 'id' ,
			treeField: 'name' ,
			title: '部门管理',
			fitColumns: true ,
			url: 'dept/list' ,
			fit:'true',
			dialog:{
				name:'部门',
				url: 'dept',
				create:{
					width:400,
					height:350,
					url:'edit',
					action:'dept/save'
				},
				update:{
					width:400,
					height:350
				}
			},
			columns: [
				[
					{field:'id',title:'ID',width:200, hidden:true},
					{field:'name',title:'部门名称',width:200},
					{field:'manager',title:'负责人',width:200}
				]
			],
			toolbar:[/* {
				text: '新增' ,
				iconCls: 'icon-add' ,
				handler: function(){
					var $grid=$('#dept_manage');
					var row=$grid.treegrid('getSelected');
					var $dialog=$('<div/>');
					$dialog.appendTo($grid.parent());
					$options=$grid.treegrid('options');
					$query=row?{parentId:row.id}:{};
					$param=$.extend({
						title: '新增' ,
						iconCls: 'icon-add' ,
						width: 260,
						href: 'dept/edit',
						grid: $grid,
						queryParams:$query,
						onClose: function(){
							$dialog.dialog('destroy');
						},
						buttons:[$.dialog.buttons.save,$.dialog.buttons.close]
					} ,$options.dialog?$options.dialog.create:{});
					$dialog.dialog($param);
				}
			}*/$.crudgrid.buttons.create,'-',$.crudgrid.buttons.update,'-',$.crudgrid.buttons.remove,'-',$.crudgrid.buttons.refresh,'-']
		});
	})
	
</script>
</body>
</html>